<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<html:html>
<head>
<title>
EPrice ~ Edicion de Precio
</title>
<link href="css/estilos.css" rel="stylesheet" type="text/css">
</head>
<script language="javascript" type="text/javascript">
function valida(){
  try{
    if(document.getElementById("str_rangoMin").value.length == 0){
      alert('Introduzca Rango Minimo');
      return false;
    }
    if(document.getElementById("str_rangoMax").value.length == 0){
      alert('Introduzca Rango Maximo');
      return false;
    }
    if(document.getElementById("str_rangoMin").value > document.getElementById("str_rangoMax").value ){
		if( document.getElementById("str_rangoMax").value != '-1' ){
	      alert('El Rango Minimo es mayor que el rango maximo');
		  return false;
		}
    }
    if(document.getElementById("str_rangoMin").value == document.getElementById("str_rangoMax").value){
      alert('Los rangos son iguales');
      return false;
    }
  }catch(e){
    alert(e);
  }finally{
  }
}
</script>
<body bgcolor="#ffffff">
<html:form action="/precioListaEd" onsubmit=" return valida();">
  <logic:empty name="precioListaEd" property="str_rangoMin">
    <html:hidden property="action" value="insertarPrecioL"/>
  </logic:empty>
  <logic:notEmpty name="precioListaEd" property="str_rangoMin">
     <html:hidden property="action" value="actualizarPrecioL"/>
  </logic:notEmpty>
  <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tabla">
    <tr>
      <td colspan="6" class="encabezadoTabla">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="40%" height="60%" align="right"><html:img width="17" height="23" src="images/img_loginFlecha.gif" alt=""/></td>
            <td width="60%" class="font_general"><strong>&nbsp;&nbsp;Edicion de Precio</strong></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td colspan="6">
        <table width="100%" class="tabla" border="0" cellpadding="0" cellspacing="1">
          <tr>
            <td width="50" align="right" class="colorLabel font_general">Grupo:&nbsp;</td>
            <td width="50" height="20" class="colorCampo font_general">
              <logic:iterate id="grupo" name="arrL_grupo">
                <html:hidden name="grupo" property="str_idGrupo"/>
                &nbsp;&nbsp;<bean:write name="grupo" property="str_descGrupo"/>
              </logic:iterate>
            </td>
            <td width="50" align="right" class="colorLabel font_general">Rango:&nbsp;</td>
            <td class="colorCampo font_general">&nbsp;&nbsp;<html:hidden property="str_rangoMinAnt"/><html:hidden property="str_rangoMaxAnt"/><html:text property="str_rangoMin" styleClass="textfield" size="10" maxlength="10"/> - <html:text property="str_rangoMax" styleClass="textfield" size="10" maxlength="10"/></td>
            <td width="70" align="center" valign="middle" class="colorCampo font_general""><html:submit styleClass="boton">Guardar</html:submit></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td align="center" class="encabezado_col font_general">Segmento</td>
      <td align="center" class="encabezado_col font_general">Cantidad</td>
      <td align="center" class="encabezado_col font_general">Segmento</td>
      <td align="center" class="encabezado_col font_general">Cantidad</td>
      <td align="center" class="encabezado_col font_general">Segmento</td>
      <td align="center" class="encabezado_col font_general">Cantidad</td>
    </tr>
    <logic:iterate id="segmento" name="arrL_segemento" indexId="int_i">
      <%=int_i.intValue()%3==0?"<tr>":""%>
        <td width="25%" class="<logic:equal name="segmento" property="bool_fila" value="true">im</logic:equal>par font_general">&nbsp;<html:hidden name="segmento" property="str_codigoSeg"/><bean:write name="segmento" property="str_descSeg"/></td>
        <td width="6" class="<logic:equal name="segmento" property="bool_fila" value="true">im</logic:equal>par font_general"><html:text name="segmento" property="str_cantidadPrecio" styleClass="textfield" style=" text-align:right" size="8" maxlength="8"></html:text></td>
      <%=int_i.intValue()%3==2?"</tr>":""%>
    </logic:iterate>
  </table>
</html:form>
<logic:present name="bool_valida">
  <script language="javascript"  type="">
  alert("Rangos Invalidos");
  history.back();
  </script>
</logic:present>
</body>
</html:html>
